package org.hamster.multidropbox.main.utils
{
	import flash.filesystem.File;
	
	import mx.core.IFlexDisplayObject;
	import mx.managers.PopUpManager;
	import mx.resources.ResourceManager;
	
	import org.hamster.multidropbox.main.mediator.AppMediator;
	import org.hamster.multidropbox.main.vo.AppConfigVO;

	public class AppUtil
	{
		public function AppUtil()
		{
		}
		
		public static function getStr(key:String):String
		{
			return ResourceManager.getInstance().getString("main", key);
		}
		
		public static function getStrStatus(key:String, ...param):String
		{
			return ResourceManager.getInstance().getString("status", key, param);
		}
		
		public static function getStrMainView(key:String):String
		{
			return ResourceManager.getInstance().getString("mainView", key);
		}
		
		public static function popup(className:Class):*
		{
			var result:IFlexDisplayObject = PopUpManager.createPopUp(PureMVCHelper.appMediator.app, className, true);
			PopUpManager.centerPopUp(result);
			return result;
		}
		
		public static function addPopup(obj:IFlexDisplayObject):void
		{
			PopUpManager.addPopUp(obj, PureMVCHelper.appMediator.app, true);
			PopUpManager.centerPopUp(obj);
		}
		
		public static function get rootFolder():String
		{
			if (AppConfigVO.TEST_MODE) {
				return "xml";
			} else {
				return File.applicationStorageDirectory.nativePath;
			}
		}
	}
}